home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Agent Central Host Computer
/
Agent - Central Host Computer.iso
/
_SETUP.1
/
vclosing.sql
< prev
next >
Wrap
Text File
|
2000-05-12
|
2KB
|
70 lines
/*
This view lists all closed items. It makes a union of the 3 types, each from its own table: normal closes from the cashclose table; unmatched probes from the prorphans table and unmatched counts from the mrorphans table.
*/
CREATE OR REPLACE VIEW VCLOSING AS
SELECT
'1' TYPE, CLO.CLBATCH_NUM, CLO.CLOSE_DATE, cas.farebox_glid, CAS.CASHBOX_GLID,
CAS.CBREMOV_DATE, CAS.CBCOUNT_DATE, CAS.PROBE_COIN_TOTALS,
tok.sm_tokens probe_sm_token_totals, tok.lg_tokens probe_lg_token_totals,
CAS.PROBE_BILL_TOTALS, CAS.PROBE_AMT, CAS.COUNT_COIN_TOTALS,
SUB.COIN_SEVEN * 100 count_sm_token_totals, SUB.COIN_eight * 100 count_lg_token_totals,
CAS.COUNT_BILL_TOTALS, CAS.COUNT_AMT, BUS.BUS_ID, cas.excp_num,
cex.descr
FROM
FAREBOX fbo,
BUS BUS,
CLOSE_BATCH CLO,
CASHCLOSE CAS,
Vtokctcashclose tok,
SUBBATCH sub,
CLOSE_EXCP cex
WHERE cas.farebox_glid = FBO.GLID AND
FBO.LOCATION = BUS.GLID AND
( CLO.CLBATCH_NUM=CAS.CLBATCH_NUM ) AND
cas.SUBBATCH_SEQ = SUB.SUBBATCH_SEQ AND
cas.last_curstate = tok.last_curstate AND
cas.excp_num = cex.num
UNION
SELECT
'2' TYPE, CLO.CLBATCH_NUM, CLO.CLOSE_DATE, pro.farebox_glid, PRO.CASHBOX_GLID,
PRO.CBREMOV_DATE, SYSDATE cbcount_date, PRO.PROBE_COIN_TOTALS,
tok.sm_tokens probe_sm_token_totals, tok.lg_tokens probe_lg_token_totals, PRO.PROBE_BILL_TOTALS,
PRO.PROBE_AMT, 0 count_coin_totals,
0 count_sm_token_totals, 0 count_lg_token_totals,
0 count_bill_totals, 0 count_amt,BUS.BUS_ID, pro.excp_num,
cex.descr
FROM
FAREBOX fbo,
BUS BUS,
CLOSE_BATCH CLO,
PRORPHANS PRO,
vtokctprorphans tok,
CLOSE_EXCP cex
WHERE pro.farebox_glid = fbo.glid AND
FBO.LOCATION = BUS.GLID AND
( CLO.CLBATCH_NUM=PRO.CLBATCH_SEQ ) AND
pro.last_curstate = tok.last_curstate AND
pro.excp_num = cex.num
UNION
SELECT
'3' TYPE, CLO.CLBATCH_NUM, CLO.CLOSE_DATE, 0 farebox_glid, MRO.CASHBOX_GLID,
SYSDATE cbremove_date, MRO.CBCOUNT_DATE, 0 probe_coin_totals,
0 probe_sm_token_totals, 0 probe_lg_token_totals, 0 probe_bill_totals,
0 probe_amt, MRO.COUNT_COIN_TOTALS,
SUB.COIN_SEVEN * 100 count_sm_token_totals, SUB.COIN_eight * 100 count_lg_token_totals,
MRO.COUNT_BILL_TOTALS,
MRO.COUNT_AMT , 0 bus_id, mro.excp_num,
cex.descr
FROM
CLOSE_BATCH CLO,
MRORPHANS MRO,
SUBBATCH sub,
CLOSE_EXCP cex
WHERE
( CLO.CLBATCH_NUM=MRO.CLBATCH_NUM )AND
mro.SUBBATCH_SEQ = SUB.SUBBATCH_SEQ AND
mro.excp_num = cex.num;